/**
 * @file
 * @author  Tsin Smith <tsin.creator@gmail.com>
 *
 */

#ifndef __TSIN_CONFIG_XMLCONFIG_HPP__
#define __TSIN_CONFIG_XMLCONFIG_HPP__

#include <tsin/config/common.hpp>

#include <tsin/config/Config.hpp>

struct _xmlDoc;

namespace tsin {

        /**
         * @class XMLConfig
         * @ingroup config
         * @brief Fetch configurations from './config.xml'.
         */
        class CONFIG_DLLEXPORT XMLConfig : public Config
        {
        public:
                enum OptionType{
                        INT,
                        STRING,
                        BOOL
                };

                static const char CONFIG_FILE[];
                static const char CONFIG_HEADER[];
                static const char CONFIG_OPTION[];

                XMLConfig();
                virtual ~XMLConfig();

                virtual int writeConfig();

        private:
                struct _xmlDoc *doc;

                int parseXML(struct _xmlDoc *doc);
                int checkOption(char *name, char *value);
                int updateOption(char *value, void *ptr, OptionType type);
        };

}

#endif /* __TSIN_CONFIG_XMLCONFIG_HPP__ */
